<%@page language="java" contentType="text/html; charset=UTF-8"  pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags" %>
<%@taglib prefix="x" uri="/soar-bx-tags"%>
<x:HeaderParts/>
<x:MainPartsTag>
<x:zone name="MainZone">
<x:Form action="auth/approle.shtml">
<x:ParamsParts>
<x:TextField name="id" type="hidden" />
</x:ParamsParts>
<x:TabParts activeIndex="0" tabs="[应用角色:'']" />
<x:SearchParts>
角色名称：<x:TextField name="searchRoleName" title="角色名称"></x:TextField>
<%-- 角色代码：<x:TextField name="searchRoleCode" title="角色代码"></x:TextField>
备注：<x:TextField name="searchRemark" title="备注"></x:TextField> --%>
</x:SearchParts>
<x:DataListParts>
	<thead>
		<tr>
			<td width="2%" align="center">序号</td>
			<td width="2%" align="center">
				<input type="checkbox" data-x="mult" data-target="ids">
			</td>
			<td width="10%" sort="T1.ROLE_NAME">角色名称</td>
			<td width="10%" sort="T1.ROLE_CODE">角色代码</td>
			<td width="13%" sort="T1.REMARK">备注</td>
			<td width="8%" sort="T1.UPDATE_DATE" align="center">更新日期</td>
			<td width="7%" align="center">操作</td>
		</tr>
	</thead>
	<tbody>
		<s:iterator value="sysPageList">
			<tr>
				<td align="center"><s:property value="PAGE_ROW_NUM"/></td>
				<td align="center">
					<input type="checkbox" value="<s:property value="ID"/>" name="ids" data-ct="<s:property value="CT"/>">
				</td>
				<td><s:property value="ROLE_NAME"/></td>
				<td><s:property value="ROLE_CODE"/></td>
				<td><s:property value="REMARK"/></td>
				<td  align="center"><s:property value="UPDATE_DATE" formatDateTime="true"/></td>
				<td  align="center">
					<input type="button" class="btn btn-info btn-xs" value="权限" onclick="X.Modal('auth/approle!roleMenu.shtml?id=<s:property value="ID"/>','','','80%','80%','角色授权')">
					<input type="button" class="btn btn-warning btn-xs" value="编辑" onclick="X.Modal('auth/approle!doShow.shtml?id=<s:property value="ID"/>','','','500px','238px','编辑角色')">
					<s:if test="CT < 1">
						<input type="button" class="btn btn-danger btn-xs" value="删除" onclick="doDelete('<s:property value="ID"/>')">
					</s:if>
					<s:else>
						<input type="button" class="btn btn-danger btn-xs" value="删除" onclick="X.Alert('此角色已有用户使用，不可删除！')">
					</s:else>
				</td>
			</tr>
		</s:iterator>
	</tbody>
</x:DataListParts>
<x:ButtonsParts>
<x:Button role="primary" value="新增" onclick="X.Modal('auth/approle!doNew.shtml','','','500px','238px','新增角色')"></x:Button>
<x:Button role="info" value="权限" onclick="plAuth()"></x:Button>
<x:Button role="danger" value="删除" onclick="doDeletePl()"></x:Button>
</x:ButtonsParts>
<x:JsParts fn="doDelete,doDeletePl,plAuth">
function plAuth()
{
	if(X.ChkSlt('ids')) 
	{
		var ids="";
		$("input[name='ids']").each(function(){
			ids+=this.value+",";
		});
		X.Modal('auth/approle!roleMenu.shtml?id='+ids,'','','80%','80%','角色权限')
	}
}
function doDeletePl()
{
	if(X.ChkSlt('ids')) 
	{
		var fg=true;
		$("input[name='ids']").each(function(){
			if($(this).attr("data-ct")!="0" && this.checked)
			{
				fg=false;
			}
		});
		if(fg)
		{
			X.Alert("确定删除选中项？","X.Submit('doDelete')");
		}else
		{
			X.Alert("选中项中包含不可删除角色！");
		}
	}
}
function doDelete(id)
{
	$("#id").val(id);
	X.Alert('确定删除？',"X.Submit('doDelete')");
}
</x:JsParts>
</x:Form>
</x:zone>
</x:MainPartsTag>
